package pri.black.dogview.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import pri.black.dogview.domain.R;
import pri.black.dogview.domain.VideoSource;
import pri.black.dogview.domain.dto.VersionInfo;
import pri.black.dogview.service.VideoSourceService;

import java.util.List;

@RestController
@RequestMapping("open-source")
public class OpenSourceController {

    @Autowired
    private VideoSourceService videoSourceService;

    @GetMapping("video-source")
    R videoSource(@RequestParam("code") String code){
        List<VideoSource> list = videoSourceService.lambdaQuery().eq(VideoSource::getCode, code).list();
        return R.ok(list);
    }

    @GetMapping("app-version")
    R appVersion(){
        VersionInfo versionInfo = new VersionInfo();
        versionInfo.setLatest(1L);
        versionInfo.setVersionName("1.0");
        versionInfo.setTips("非必须更新");
        versionInfo.setUrl("http://121.40.96.168/app-release.apk");
        return R.ok(versionInfo);
    }
}
